#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const int N=2e3+5;
int n,m,k,p;
ll jc[N],ny[N];
ll ksm(ll x,int y){
    if(y<0){
        return ksm(ksm(x,-y),p-2);
    }
    ll an=1;
    while(y){
        if(y&1)an=an*x%p;
        x=x*x%p;
        y>>=1;
    }
    return an;
}
ll C(int x,int y){
    return jc[x]*ny[y]%p*ny[x-y]%p;
}
ll f[N][N];
ll s[N][N];
int main(){
    freopen("sequence.in","r",stdin);
    freopen("sequence.out","w",stdout);
    cin>>n>>m>>k>>p;
    if(m>n){
        cout<<0;
        return 0;
    }
    jc[0]=1;
    for(int i=1;i<=n;++i){
        jc[i]=jc[i-1]*i%p;
    }
    ny[n]=ksm(jc[n],p-2);
    for(int i=n;i;--i){
        ny[i-1]=ny[i]*i%p;
    }
    f[0][0]=1;
    for(int i=1;i<=m;++i){
        for(int j=1;j<=n;++j){
            ;
        }
    }
    cout<<f[m][n];
    return 0;
}